<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">-- | An implementation of ResourceHandle-based variables.</span><span>
</span><span id="line-2"></span><span class="hs-comment">--</span><span>
</span><span id="line-3"></span><span class="hs-comment">-- The main difference between this and 'Ref'-based variables is</span><span>
</span><span id="line-4"></span><span class="hs-comment">-- that reads are explicit, via the 'readValue' op.</span><span>
</span><span id="line-5"></span><span class="hs-comment">--</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- TODO: given that distinction, figure out a good story around</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- gradients and save/restore.  Then, merge this module into</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- TensorFlow.Ops.</span><span>
</span><span id="line-9"></span><span class="hs-pragma">{-# LANGUAGE DataKinds #-}</span><span>
</span><span id="line-10"></span><span class="hs-pragma">{-# LANGUAGE FlexibleContexts #-}</span><span>
</span><span id="line-11"></span><span class="hs-pragma">{-# LANGUAGE RecursiveDo #-}</span><span>
</span><span id="line-12"></span><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables #-}</span><span>
</span><span id="line-13"></span><span class="hs-pragma">{-# LANGUAGE OverloadedStrings #-}</span><span>
</span><span id="line-14"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">TensorFlow.Variable</span><span>
</span><span id="line-15"></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier">Variable</span></a></span><span>
</span><span id="line-16"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#variable"><span class="hs-identifier">variable</span></a></span><span>
</span><span id="line-17"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#variable%27"><span class="hs-identifier">variable'</span></a></span><span>
</span><span id="line-18"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#readValue"><span class="hs-identifier">readValue</span></a></span><span>
</span><span id="line-19"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#initializedValue"><span class="hs-identifier">initializedValue</span></a></span><span>
</span><span id="line-20"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#initializedVariable"><span class="hs-identifier">initializedVariable</span></a></span><span>
</span><span id="line-21"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#initializedVariable%27"><span class="hs-identifier">initializedVariable'</span></a></span><span>
</span><span id="line-22"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#zeroInitializedVariable"><span class="hs-identifier">zeroInitializedVariable</span></a></span><span>
</span><span id="line-23"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#zeroInitializedVariable%27"><span class="hs-identifier">zeroInitializedVariable'</span></a></span><span>
</span><span id="line-24"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#assign"><span class="hs-identifier">assign</span></a></span><span>
</span><span id="line-25"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#assign%27"><span class="hs-identifier">assign'</span></a></span><span>
</span><span id="line-26"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#assignAdd"><span class="hs-identifier">assignAdd</span></a></span><span>
</span><span id="line-27"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#assignAdd%27"><span class="hs-identifier">assignAdd'</span></a></span><span>
</span><span id="line-28"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#resourceApplyAdam"><span class="hs-identifier">resourceApplyAdam</span></a></span><span>
</span><span id="line-29"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#resourceApplyAdam%27"><span class="hs-identifier">resourceApplyAdam'</span></a></span><span>
</span><span id="line-30"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-31"></span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><span class="hs-identifier">Data.Complex</span></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><span class="hs-identifier">Data.Int</span></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><span class="hs-identifier">Data.Word</span></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.Text.Encoding</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">encodeUtf8</span></span><span class="hs-special">)</span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Lens.Family2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-operator">(.~)</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-operator">(&amp;)</span></span><span class="hs-special">)</span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">TensorFlow.Core</span></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">TensorFlow.Build</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">opDef</span></span><span class="hs-special">)</span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">TensorFlow.BuildOp</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">buildInputs</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">pureOp</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">OpParams</span></span><span class="hs-special">)</span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">TensorFlow.Output</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">opInputs</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">unNodeName</span></span><span class="hs-special">)</span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">TensorFlow.Tensor</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">Rendered</span></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">ToTensor</span></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">renderValue</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">tensorNodeName</span></span><span class="hs-special">)</span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">TensorFlow.Types</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">tensorType</span></span><span class="hs-special">)</span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><span class="hs-identifier">TensorFlow.GenOps.Core</span></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">CoreOps</span></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="TensorFlow.Ops.html"><span class="hs-identifier">TensorFlow.Ops</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Ops.html#zeros"><span class="hs-identifier">zeros</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-45"></span><span>
</span><span id="line-46"></span><span class="hs-keyword">data</span><span> </span><span id="Variable"><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-var">Variable</span></a></span></span><span> </span><span id="local-6989586621679157976"><span class="annot"><a href="#local-6989586621679157976"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Variable"><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-var">Variable</span></a></span></span><span>
</span><span id="line-47"></span><span>    </span><span class="hs-special">{</span><span> </span><span id="variableHandle"><span class="annot"><span class="annottext">Variable a -&gt; Tensor Value ResourceHandle
</span><a href="TensorFlow.Variable.html#variableHandle"><span class="hs-identifier hs-var hs-var">variableHandle</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Value</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">ResourceHandle</span></span><span>
</span><span id="line-48"></span><span>    </span><span class="hs-special">,</span><span> </span><span id="initializedValue"><span class="annot"><span class="annottext">Variable a -&gt; Maybe (Tensor Value a)
</span><a href="TensorFlow.Variable.html#initializedValue"><span class="hs-identifier hs-var hs-var">initializedValue</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Maybe</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Value</span></span><span> </span><span class="annot"><a href="#local-6989586621679157976"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-49"></span><span>      </span><span class="hs-comment">-- ^ The initial value of a 'Variable' created with 'initializedVariable'.</span><span>
</span><span id="line-50"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-51"></span><span>
</span><span id="line-52"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Rendered</span></span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-53"></span><span>    </span><span id="local-6989586621679157784"><span class="annot"><span class="annottext">renderedOutput :: Variable a -&gt; Output
</span><span class="hs-identifier hs-var hs-var hs-var hs-var">renderedOutput</span></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tensor Value ResourceHandle -&gt; Output
forall (t :: * -&gt; *) a. Rendered t =&gt; t a -&gt; Output
</span><span class="hs-identifier hs-var">renderedOutput</span></span><span> </span><span class="annot"><span class="annottext">(Tensor Value ResourceHandle -&gt; Output)
-&gt; (Variable a -&gt; Tensor Value ResourceHandle)
-&gt; Variable a
-&gt; Output
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">Variable a -&gt; Tensor Value ResourceHandle
forall a. Variable a -&gt; Tensor Value ResourceHandle
</span><a href="TensorFlow.Variable.html#variableHandle"><span class="hs-identifier hs-var hs-var">variableHandle</span></a></span><span>
</span><span id="line-54"></span><span>
</span><span id="line-55"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><span class="hs-identifier hs-type">ToTensor</span></span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-56"></span><span>    </span><span id="local-6989586621679157779"><span class="annot"><span class="annottext">toTensor :: Variable a -&gt; Tensor Build a
</span><span class="hs-identifier hs-var hs-var hs-var hs-var">toTensor</span></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Variable a -&gt; Tensor Build a
forall a. TensorType a =&gt; Variable a -&gt; Tensor Build a
</span><a href="TensorFlow.Variable.html#readValue"><span class="hs-identifier hs-var">readValue</span></a></span><span>
</span><span id="line-57"></span><span>
</span><span id="line-58"></span><span class="hs-comment">-- | Creates a new, uninitialized variable.</span><span>
</span><span id="line-59"></span><span id="local-6989586621679157776"><span id="local-6989586621679157777"><span class="annot"><a href="TensorFlow.Variable.html#variable"><span class="hs-identifier hs-type">variable</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679157777"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679157776"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Shape</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679157777"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157776"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-60"></span><span id="variable"><span class="annot"><span class="annottext">variable :: Shape -&gt; m (Variable a)
</span><a href="TensorFlow.Variable.html#variable"><span class="hs-identifier hs-var hs-var">variable</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Shape -&gt; m (Variable a)
forall (m :: * -&gt; *) a.
(MonadBuild m, TensorType a) =&gt;
OpParams -&gt; Shape -&gt; m (Variable a)
</span><a href="TensorFlow.Variable.html#variable%27"><span class="hs-identifier hs-var">variable'</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
forall a. a -&gt; a
</span><span class="hs-identifier hs-var">id</span></span><span>
</span><span id="line-61"></span><span>
</span><span id="line-62"></span><span class="annot"><a href="TensorFlow.Variable.html#variable%27"><span class="hs-identifier hs-type">variable'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679157965"><span class="annot"><a href="#local-6989586621679157965"><span class="hs-identifier hs-type">m</span></a></span></span><span> </span><span id="local-6989586621679157963"><span class="annot"><a href="#local-6989586621679157963"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679157965"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679157963"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-63"></span><span>                    </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpParams</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Shape</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679157965"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157963"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-64"></span><span id="variable%27"><span class="annot"><span class="annottext">variable' :: OpParams -&gt; Shape -&gt; m (Variable a)
</span><a href="TensorFlow.Variable.html#variable%27"><span class="hs-identifier hs-var hs-var">variable'</span></a></span></span><span> </span><span id="local-6989586621679157774"><span class="annot"><span class="annottext">params :: OpParams
</span><a href="#local-6989586621679157774"><span class="hs-identifier hs-var">params</span></a></span></span><span> </span><span id="local-6989586621679157773"><span class="annot"><span class="annottext">s :: Shape
</span><a href="#local-6989586621679157773"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Maybe Shape -&gt; m (Variable a)
forall (m :: * -&gt; *) a.
(MonadBuild m, TensorType a) =&gt;
OpParams -&gt; Maybe Shape -&gt; m (Variable a)
</span><a href="TensorFlow.Variable.html#variableInternal"><span class="hs-identifier hs-var">variableInternal</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
</span><a href="#local-6989586621679157774"><span class="hs-identifier hs-var">params</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Shape -&gt; Maybe Shape
forall a. a -&gt; Maybe a
</span><span class="hs-identifier hs-var">Just</span></span><span> </span><span class="annot"><span class="annottext">Shape
</span><a href="#local-6989586621679157773"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-65"></span><span>
</span><span id="line-66"></span><span class="annot"><a href="TensorFlow.Variable.html#variableInternal"><span class="hs-identifier hs-type">variableInternal</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679157959"><span class="annot"><a href="#local-6989586621679157959"><span class="hs-identifier hs-type">m</span></a></span></span><span> </span><span id="local-6989586621679157958"><span class="annot"><a href="#local-6989586621679157958"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679157959"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679157958"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-67"></span><span>                 </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpParams</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Maybe</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Shape</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679157959"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157958"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-68"></span><span id="variableInternal"><span class="annot"><span class="annottext">variableInternal :: OpParams -&gt; Maybe Shape -&gt; m (Variable a)
</span><a href="TensorFlow.Variable.html#variableInternal"><span class="hs-identifier hs-var hs-var">variableInternal</span></a></span></span><span> </span><span id="local-6989586621679157771"><span class="annot"><span class="annottext">params :: OpParams
</span><a href="#local-6989586621679157771"><span class="hs-identifier hs-var">params</span></a></span></span><span> </span><span id="local-6989586621679157770"><span class="annot"><span class="annottext">s :: Maybe Shape
</span><a href="#local-6989586621679157770"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Build (Variable a) -&gt; m (Variable a)
forall (m :: * -&gt; *) a. MonadBuild m =&gt; Build a -&gt; m a
</span><span class="hs-identifier hs-var">build</span></span><span> </span><span class="annot"><span class="annottext">(Build (Variable a) -&gt; m (Variable a))
-&gt; Build (Variable a) -&gt; m (Variable a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-69"></span><span>    </span><span class="hs-comment">-- Each variable needs a unique &quot;shared_name&quot;.  Use MonadFix to</span><span>
</span><span id="line-70"></span><span>    </span><span class="hs-comment">-- set the attribute to the same name as the variable itself, without</span><span>
</span><span id="line-71"></span><span>    </span><span class="hs-comment">-- exposing more internals of the Build module.</span><span>
</span><span id="line-72"></span><span>    </span><span class="hs-keyword">rec</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679157768"><span class="annot"><span class="annottext">attrs :: OpParams
</span><a href="#local-6989586621679157768"><span class="hs-identifier hs-var hs-var">attrs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams
</span><a href="#local-6989586621679157771"><span class="hs-identifier hs-var">params</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; OpParams -&gt; OpParams
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Lens' OpDef ByteString
forall a. Attribute a =&gt; Text -&gt; Lens' OpDef a
</span><span class="hs-identifier hs-var">opAttr</span></span><span> </span><span class="annot"><span class="hs-string">&quot;shared_name&quot;</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *). Identical f =&gt; LensLike' f OpDef ByteString)
-&gt; ByteString -&gt; OpParams
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679157766"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; OpParams -&gt; OpParams
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Lens' OpDef (Maybe Shape)
forall a. Attribute a =&gt; Text -&gt; Lens' OpDef a
</span><span class="hs-identifier hs-var">opAttr</span></span><span> </span><span class="annot"><span class="hs-string">&quot;shape&quot;</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *).
 Identical f =&gt;
 LensLike' f OpDef (Maybe Shape))
-&gt; Maybe Shape -&gt; OpParams
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="annot"><span class="annottext">Maybe Shape
</span><a href="#local-6989586621679157770"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-73"></span><span>            </span><span id="local-6989586621679157765"><span class="annot"><span class="annottext">dtype :: DataType
</span><a href="#local-6989586621679157765"><span class="hs-identifier hs-var hs-var">dtype</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; DataType
forall a. TensorType a =&gt; a -&gt; DataType
</span><span class="hs-identifier hs-var">tensorType</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
forall a. HasCallStack =&gt; a
</span><span class="hs-identifier hs-var">undefined</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679157958"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-74"></span><span>            </span><span class="hs-comment">-- Generated ops don't support unknown shapes. As a workaround, we</span><span>
</span><span id="line-75"></span><span>            </span><span class="hs-comment">-- pass in a rank zero shape and then override it using OpParams.</span><span>
</span><span id="line-76"></span><span>            </span><span class="hs-comment">-- TODO: Consider supporting this better in op generation.</span><span>
</span><span id="line-77"></span><span>            </span><span id="local-6989586621679157763"><span class="annot"><span class="annottext">shape :: Shape
</span><a href="#local-6989586621679157763"><span class="hs-identifier hs-var hs-var">shape</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Int64] -&gt; Shape
</span><span class="hs-identifier hs-var">Shape</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-78"></span><span>        </span><span id="local-6989586621679157761"><span class="annot"><span class="annottext">Tensor Value ResourceHandle
</span><a href="#local-6989586621679157761"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">OpParams
-&gt; DataType
-&gt; Shape
-&gt; BuildT Identity (Tensor Value ResourceHandle)
forall (m' :: * -&gt; *).
MonadBuild m' =&gt;
OpParams -&gt; DataType -&gt; Shape -&gt; m' (Tensor Value ResourceHandle)
</span><span class="hs-identifier hs-var">CoreOps.varHandleOp'</span></span><span> </span><span class="annot"><span class="annottext">OpParams
</span><a href="#local-6989586621679157768"><span class="hs-identifier hs-var">attrs</span></a></span><span> </span><span class="annot"><span class="annottext">DataType
</span><a href="#local-6989586621679157765"><span class="hs-identifier hs-var">dtype</span></a></span><span> </span><span class="annot"><span class="annottext">Shape
</span><a href="#local-6989586621679157763"><span class="hs-identifier hs-var">shape</span></a></span><span>
</span><span id="line-79"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679157766"><span class="annot"><span class="annottext">n :: ByteString
</span><a href="#local-6989586621679157766"><span class="hs-identifier hs-var hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; ByteString
</span><span class="hs-identifier hs-var">encodeUtf8</span></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; ByteString) -&gt; Text -&gt; ByteString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">NodeName -&gt; Text
</span><span class="hs-identifier hs-var hs-var">unNodeName</span></span><span> </span><span class="annot"><span class="annottext">(NodeName -&gt; Text) -&gt; NodeName -&gt; Text
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">Tensor Value ResourceHandle -&gt; NodeName
forall (t :: * -&gt; *) a. Rendered t =&gt; t a -&gt; NodeName
</span><span class="hs-identifier hs-var">tensorNodeName</span></span><span> </span><span class="annot"><span class="annottext">Tensor Value ResourceHandle
</span><a href="#local-6989586621679157761"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-80"></span><span>    </span><span class="annot"><span class="annottext">Variable a -&gt; Build (Variable a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><span class="hs-identifier hs-var">return</span></span><span> </span><span class="annot"><span class="annottext">(Variable a -&gt; Build (Variable a))
-&gt; Variable a -&gt; Build (Variable a)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">Tensor Value ResourceHandle -&gt; Maybe (Tensor Value a) -&gt; Variable a
forall a.
Tensor Value ResourceHandle -&gt; Maybe (Tensor Value a) -&gt; Variable a
</span><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-var">Variable</span></a></span><span> </span><span class="annot"><span class="annottext">Tensor Value ResourceHandle
</span><a href="#local-6989586621679157761"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (Tensor Value a)
forall a. Maybe a
</span><span class="hs-identifier hs-var">Nothing</span></span><span>
</span><span id="line-81"></span><span>
</span><span id="line-82"></span><span class="hs-comment">-- | Creates a variable initialized to the given value.</span><span>
</span><span id="line-83"></span><span class="hs-comment">-- Initialization happens next time session runs.</span><span>
</span><span id="line-84"></span><span id="local-6989586621679157757"><span id="local-6989586621679157758"><span id="local-6989586621679157759"><span class="annot"><a href="TensorFlow.Variable.html#initializedVariable"><span class="hs-identifier hs-type">initializedVariable</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679157759"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679157758"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-85"></span><span>                    </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679157757"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157758"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679157759"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157758"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-86"></span><span id="initializedVariable"><span class="annot"><span class="annottext">initializedVariable :: Tensor v a -&gt; m (Variable a)
</span><a href="TensorFlow.Variable.html#initializedVariable"><span class="hs-identifier hs-var hs-var">initializedVariable</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Tensor v a -&gt; m (Variable a)
forall a (m :: * -&gt; *) (v :: * -&gt; *).
(MonadBuild m, TensorType a) =&gt;
OpParams -&gt; Tensor v a -&gt; m (Variable a)
</span><a href="TensorFlow.Variable.html#initializedVariable%27"><span class="hs-identifier hs-var">initializedVariable'</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
forall a. a -&gt; a
</span><span class="hs-identifier hs-var">id</span></span><span>
</span><span id="line-87"></span><span>
</span><span id="line-88"></span><span class="annot"><a href="TensorFlow.Variable.html#initializedVariable%27"><span class="hs-identifier hs-type">initializedVariable'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679157917"><span class="annot"><a href="#local-6989586621679157917"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span id="local-6989586621679157918"><span class="annot"><a href="#local-6989586621679157918"><span class="hs-identifier hs-type">m</span></a></span></span><span> </span><span id="local-6989586621679157916"><span class="annot"><a href="#local-6989586621679157916"><span class="hs-identifier hs-type">v</span></a></span></span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679157918"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679157917"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-89"></span><span>                    </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpParams</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679157916"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157917"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679157918"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157917"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-90"></span><span id="initializedVariable%27"><span class="annot"><span class="annottext">initializedVariable' :: OpParams -&gt; Tensor v a -&gt; m (Variable a)
</span><a href="TensorFlow.Variable.html#initializedVariable%27"><span class="hs-identifier hs-var hs-var">initializedVariable'</span></a></span></span><span> </span><span id="local-6989586621679157756"><span class="annot"><span class="annottext">params :: OpParams
</span><a href="#local-6989586621679157756"><span class="hs-identifier hs-var">params</span></a></span></span><span> </span><span id="local-6989586621679157755"><span class="annot"><span class="annottext">initializer :: Tensor v a
</span><a href="#local-6989586621679157755"><span class="hs-identifier hs-var">initializer</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-91"></span><span>    </span><span class="hs-comment">-- The shape is not known initially.</span><span>
</span><span id="line-92"></span><span>    </span><span id="local-6989586621679157754"><span class="annot"><span class="annottext">Variable a
</span><a href="#local-6989586621679157754"><span class="hs-identifier hs-var">variables</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Maybe Shape -&gt; m (Variable a)
forall (m :: * -&gt; *) a.
(MonadBuild m, TensorType a) =&gt;
OpParams -&gt; Maybe Shape -&gt; m (Variable a)
</span><a href="TensorFlow.Variable.html#variableInternal"><span class="hs-identifier hs-var">variableInternal</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
</span><a href="#local-6989586621679157756"><span class="hs-identifier hs-var">params</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Shape
forall a. Maybe a
</span><span class="hs-identifier hs-var">Nothing</span></span><span>
</span><span id="line-93"></span><span>    </span><span id="local-6989586621679157753"><span class="annot"><span class="annottext">Tensor Value ResourceHandle
</span><a href="#local-6989586621679157753"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Tensor Value ResourceHandle -&gt; m (Tensor Value ResourceHandle)
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><span class="hs-identifier hs-var">pure</span></span><span> </span><span class="annot"><span class="annottext">(Tensor Value ResourceHandle -&gt; m (Tensor Value ResourceHandle))
-&gt; Tensor Value ResourceHandle -&gt; m (Tensor Value ResourceHandle)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Variable a
</span><a href="#local-6989586621679157754"><span class="hs-identifier hs-var">variables</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-94"></span><span>                  </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span id="local-6989586621679157752"><span class="annot"><span class="annottext">h :: Tensor Value ResourceHandle
</span><a href="#local-6989586621679157752"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Nothing</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157917"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Tensor Value ResourceHandle
</span><a href="#local-6989586621679157752"><span class="hs-identifier hs-var">h</span></a></span><span>
</span><span id="line-95"></span><span>                  </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Char] -&gt; Tensor Value ResourceHandle
forall a. HasCallStack =&gt; [Char] -&gt; a
</span><span class="hs-identifier hs-var">error</span></span><span> </span><span class="annot"><span class="hs-string">&quot;variableInternal is empty&quot;</span></span><span>
</span><span id="line-96"></span><span>    </span><span id="local-6989586621679157750"><span class="annot"><span class="annottext">Tensor Value a
</span><a href="#local-6989586621679157750"><span class="hs-identifier hs-var">initializer'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Tensor v a -&gt; m (Tensor Value a)
forall (m :: * -&gt; *) (v :: * -&gt; *) a.
MonadBuild m =&gt;
Tensor v a -&gt; m (Tensor Value a)
</span><span class="hs-identifier hs-var">renderValue</span></span><span> </span><span class="annot"><span class="annottext">Tensor v a
</span><a href="#local-6989586621679157755"><span class="hs-identifier hs-var">initializer</span></a></span><span>
</span><span id="line-97"></span><span>    </span><span id="local-6989586621679157749"><span class="annot"><span class="annottext">ControlNode
</span><a href="#local-6989586621679157749"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Tensor Value ResourceHandle -&gt; Tensor Value a -&gt; m ControlNode
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) dtype (m' :: * -&gt; *).
(MonadBuild m', TensorType dtype) =&gt;
Tensor v'1 ResourceHandle -&gt; Tensor v'2 dtype -&gt; m' ControlNode
</span><span class="hs-identifier hs-var">CoreOps.assignVariableOp</span></span><span> </span><span class="annot"><span class="annottext">Tensor Value ResourceHandle
</span><a href="#local-6989586621679157753"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">Tensor Value a
</span><a href="#local-6989586621679157750"><span class="hs-identifier hs-var">initializer'</span></a></span><span>
</span><span id="line-98"></span><span>    </span><span class="annot"><span class="annottext">ControlNode -&gt; m ()
forall (m :: * -&gt; *). MonadBuild m =&gt; ControlNode -&gt; m ()
</span><span class="hs-identifier hs-var">addInitializer</span></span><span> </span><span class="annot"><span class="annottext">(ControlNode -&gt; m ()) -&gt; m ControlNode -&gt; m ()
forall (m :: * -&gt; *) a b. Monad m =&gt; (a -&gt; m b) -&gt; m a -&gt; m b
</span><span class="hs-operator hs-var">=&lt;&lt;</span></span><span> </span><span class="annot"><span class="annottext">ControlNode -&gt; m ControlNode
forall (m :: * -&gt; *) t.
(MonadBuild m, Nodes t) =&gt;
t -&gt; m ControlNode
</span><span class="hs-identifier hs-var">group</span></span><span> </span><span class="annot"><span class="annottext">ControlNode
</span><a href="#local-6989586621679157749"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-99"></span><span>    </span><span class="annot"><span class="annottext">Variable a -&gt; m (Variable a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><span class="hs-identifier hs-var">return</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Tensor Value ResourceHandle -&gt; Maybe (Tensor Value a) -&gt; Variable a
forall a.
Tensor Value ResourceHandle -&gt; Maybe (Tensor Value a) -&gt; Variable a
</span><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-var">Variable</span></a></span><span> </span><span class="annot"><span class="annottext">Tensor Value ResourceHandle
</span><a href="#local-6989586621679157753"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Tensor Value a -&gt; Maybe (Tensor Value a)
forall a. a -&gt; Maybe a
</span><span class="hs-identifier hs-var">Just</span></span><span> </span><span class="annot"><span class="annottext">Tensor Value a
</span><a href="#local-6989586621679157750"><span class="hs-identifier hs-var">initializer'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-100"></span><span>
</span><span id="line-101"></span><span class="hs-comment">-- | Creates a zero-initialized variable with the given shape.</span><span>
</span><span id="line-102"></span><span id="local-6989586621679157743"><span id="local-6989586621679157744"><span class="annot"><a href="TensorFlow.Variable.html#zeroInitializedVariable"><span class="hs-identifier hs-type">zeroInitializedVariable</span></a></span><span>
</span><span id="line-103"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679157744"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679157743"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Num</span></span><span> </span><span class="annot"><a href="#local-6989586621679157743"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Shape</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679157744"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157743"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-104"></span><span id="zeroInitializedVariable"><span class="annot"><span class="annottext">zeroInitializedVariable :: Shape -&gt; m (Variable a)
</span><a href="TensorFlow.Variable.html#zeroInitializedVariable"><span class="hs-identifier hs-var hs-var">zeroInitializedVariable</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Shape -&gt; m (Variable a)
forall (m :: * -&gt; *) a.
(MonadBuild m, TensorType a, Num a) =&gt;
OpParams -&gt; Shape -&gt; m (Variable a)
</span><a href="TensorFlow.Variable.html#zeroInitializedVariable%27"><span class="hs-identifier hs-var">zeroInitializedVariable'</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
forall a. a -&gt; a
</span><span class="hs-identifier hs-var">id</span></span><span>
</span><span id="line-105"></span><span>
</span><span id="line-106"></span><span id="local-6989586621679157890"><span id="local-6989586621679157891"><span class="annot"><a href="TensorFlow.Variable.html#zeroInitializedVariable%27"><span class="hs-identifier hs-type">zeroInitializedVariable'</span></a></span><span>
</span><span id="line-107"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679157891"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679157890"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Num</span></span><span> </span><span class="annot"><a href="#local-6989586621679157890"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpParams</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Shape</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679157891"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157890"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-108"></span><span id="zeroInitializedVariable%27"><span class="annot"><span class="annottext">zeroInitializedVariable' :: OpParams -&gt; Shape -&gt; m (Variable a)
</span><a href="TensorFlow.Variable.html#zeroInitializedVariable%27"><span class="hs-identifier hs-var hs-var">zeroInitializedVariable'</span></a></span></span><span> </span><span id="local-6989586621679157742"><span class="annot"><span class="annottext">params :: OpParams
</span><a href="#local-6989586621679157742"><span class="hs-identifier hs-var">params</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Tensor Build a -&gt; m (Variable a)
forall a (m :: * -&gt; *) (v :: * -&gt; *).
(MonadBuild m, TensorType a) =&gt;
OpParams -&gt; Tensor v a -&gt; m (Variable a)
</span><a href="TensorFlow.Variable.html#initializedVariable%27"><span class="hs-identifier hs-var">initializedVariable'</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
</span><a href="#local-6989586621679157742"><span class="hs-identifier hs-var">params</span></a></span><span> </span><span class="annot"><span class="annottext">(Tensor Build a -&gt; m (Variable a))
-&gt; (Shape -&gt; Tensor Build a) -&gt; Shape -&gt; m (Variable a)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">Shape -&gt; Tensor Build a
forall a. (Num a, TensorType a) =&gt; Shape -&gt; Tensor Build a
</span><a href="TensorFlow.Ops.html#zeros"><span class="hs-identifier hs-var">zeros</span></a></span><span>
</span><span id="line-109"></span><span>
</span><span id="line-110"></span><span class="hs-comment">-- | Gets the value stored in a variable.</span><span>
</span><span id="line-111"></span><span class="hs-comment">--</span><span>
</span><span id="line-112"></span><span class="hs-comment">-- Note that this op is stateful since it depends on the value of the variable;</span><span>
</span><span id="line-113"></span><span class="hs-comment">-- however, it may be CSE'd with other reads in the same context.  The context can</span><span>
</span><span id="line-114"></span><span class="hs-comment">-- be fixed by using 'render' along with (for example) 'withControlDependencies'.</span><span>
</span><span id="line-115"></span><span class="hs-comment">-- For example:</span><span>
</span><span id="line-116"></span><span class="hs-comment">--</span><span>
</span><span id="line-117"></span><span class="hs-comment">-- &gt;   runSession $ do</span><span>
</span><span id="line-118"></span><span class="hs-comment">-- &gt;     v &lt;- variable []</span><span>
</span><span id="line-119"></span><span class="hs-comment">-- &gt;     a &lt;- assign v 24</span><span>
</span><span id="line-120"></span><span class="hs-comment">-- &gt;     r &lt;- withControlDependencies a $ render $ readValue v + 18</span><span>
</span><span id="line-121"></span><span class="hs-comment">-- &gt;     result &lt;- run r</span><span>
</span><span id="line-122"></span><span class="hs-comment">-- &gt;     liftIO $ (42 :: Float) @=? unScalar result</span><span>
</span><span id="line-123"></span><span class="hs-comment">--</span><span>
</span><span id="line-124"></span><span class="hs-comment">--</span><span>
</span><span id="line-125"></span><span id="local-6989586621679157741"><span class="annot"><a href="TensorFlow.Variable.html#readValue"><span class="hs-identifier hs-type">readValue</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679157741"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157741"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><a href="#local-6989586621679157741"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-126"></span><span id="readValue"><span class="annot"><span class="annottext">readValue :: Variable a -&gt; Tensor Build a
</span><a href="TensorFlow.Variable.html#readValue"><span class="hs-identifier hs-var hs-var">readValue</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Variable a -&gt; Tensor Build a
forall a. TensorType a =&gt; OpParams -&gt; Variable a -&gt; Tensor Build a
</span><a href="TensorFlow.Variable.html#readValue%27"><span class="hs-identifier hs-var">readValue'</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
forall a. a -&gt; a
</span><span class="hs-identifier hs-var">id</span></span><span>
</span><span id="line-127"></span><span>
</span><span id="line-128"></span><span class="annot"><a href="TensorFlow.Variable.html#readValue%27"><span class="hs-identifier hs-type">readValue'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679157885"><span class="annot"><a href="#local-6989586621679157885"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-operator">.</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679157885"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-129"></span><span>    </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpParams</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157885"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Build</span></span><span> </span><span class="annot"><a href="#local-6989586621679157885"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-130"></span><span id="readValue%27"><span class="annot"><span class="annottext">readValue' :: OpParams -&gt; Variable a -&gt; Tensor Build a
</span><a href="TensorFlow.Variable.html#readValue%27"><span class="hs-identifier hs-var hs-var">readValue'</span></a></span></span><span> </span><span id="local-6989586621679157739"><span class="annot"><span class="annottext">params :: OpParams
</span><a href="#local-6989586621679157739"><span class="hs-identifier hs-var">params</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span id="local-6989586621679157738"><span class="annot"><span class="annottext">h :: Tensor Value ResourceHandle
</span><a href="#local-6989586621679157738"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span>
</span><span id="line-131"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Int64] -&gt; Build OpDef -&gt; Tensor Build a
forall a. PureResult a =&gt; [Int64] -&gt; Build OpDef -&gt; a
</span><span class="hs-identifier hs-var">pureOp</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">(Build OpDef -&gt; Tensor Build a) -&gt; Build OpDef -&gt; Tensor Build a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-132"></span><span>        </span><span id="local-6989586621679157737"><span class="annot"><span class="annottext">[Output]
</span><a href="#local-6989586621679157737"><span class="hs-identifier hs-var">os</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Tensor Value ResourceHandle -&gt; Build [Output]
forall a. BuildInputs a =&gt; a -&gt; Build [Output]
</span><span class="hs-identifier hs-var">buildInputs</span></span><span> </span><span class="annot"><span class="annottext">Tensor Value ResourceHandle
</span><a href="#local-6989586621679157738"><span class="hs-identifier hs-var">h</span></a></span><span>
</span><span id="line-133"></span><span>        </span><span class="annot"><span class="annottext">OpDef -&gt; Build OpDef
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><span class="hs-identifier hs-var">pure</span></span><span> </span><span class="annot"><span class="annottext">(OpDef -&gt; Build OpDef) -&gt; OpDef -&gt; Build OpDef
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">OpType -&gt; OpDef
</span><span class="hs-identifier hs-var">opDef</span></span><span> </span><span class="annot"><span class="hs-string">&quot;ReadVariableOp&quot;</span></span><span>
</span><span id="line-134"></span><span>                </span><span class="annot"><span class="annottext">OpDef -&gt; OpParams -&gt; OpDef
forall s t. s -&gt; (s -&gt; t) -&gt; t
</span><span class="hs-operator hs-var">&amp;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OpParams
</span><a href="#local-6989586621679157739"><span class="hs-identifier hs-var">params</span></a></span><span>
</span><span id="line-135"></span><span>                    </span><span class="annot"><span class="annottext">OpParams -&gt; OpParams -&gt; OpParams
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Lens' OpDef DataType
forall a. Attribute a =&gt; Text -&gt; Lens' OpDef a
</span><span class="hs-identifier hs-var">opAttr</span></span><span> </span><span class="annot"><span class="hs-string">&quot;dtype&quot;</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *). Identical f =&gt; LensLike' f OpDef DataType)
-&gt; DataType -&gt; OpParams
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="annot"><span class="annottext">a -&gt; DataType
forall a. TensorType a =&gt; a -&gt; DataType
</span><span class="hs-identifier hs-var">tensorType</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
forall a. HasCallStack =&gt; a
</span><span class="hs-identifier hs-var">undefined</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679157885"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-136"></span><span>                    </span><span class="annot"><span class="annottext">OpParams -&gt; OpParams -&gt; OpParams
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Lens' OpDef [Output]
forall (f :: * -&gt; *). Identical f =&gt; LensLike' f OpDef [Output]
</span><span class="hs-identifier hs-var">opInputs</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *). Identical f =&gt; LensLike' f OpDef [Output])
-&gt; [Output] -&gt; OpParams
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="annot"><span class="annottext">[Output]
</span><a href="#local-6989586621679157737"><span class="hs-identifier hs-var">os</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-137"></span><span>
</span><span id="line-138"></span><span class="hs-comment">-- | Sets the value of a variable.</span><span>
</span><span id="line-139"></span><span id="local-6989586621679157734"><span id="local-6989586621679157735"><span id="local-6989586621679157736"><span class="annot"><a href="TensorFlow.Variable.html#assign"><span class="hs-identifier hs-type">assign</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679157736"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679157735"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-140"></span><span>    </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157735"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679157734"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157735"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679157736"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">ControlNode</span></span></span></span></span><span>
</span><span id="line-141"></span><span id="assign"><span class="annot"><span class="annottext">assign :: Variable a -&gt; Tensor v a -&gt; m ControlNode
</span><a href="TensorFlow.Variable.html#assign"><span class="hs-identifier hs-var hs-var">assign</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Variable a -&gt; Tensor v a -&gt; m ControlNode
forall (m :: * -&gt; *) a (v :: * -&gt; *).
(MonadBuild m, TensorType a) =&gt;
OpParams -&gt; Variable a -&gt; Tensor v a -&gt; m ControlNode
</span><a href="TensorFlow.Variable.html#assign%27"><span class="hs-identifier hs-var">assign'</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
forall a. a -&gt; a
</span><span class="hs-identifier hs-var">id</span></span><span>
</span><span id="line-142"></span><span>
</span><span id="line-143"></span><span id="local-6989586621679157869"><span id="local-6989586621679157870"><span id="local-6989586621679157871"><span class="annot"><a href="TensorFlow.Variable.html#assign%27"><span class="hs-identifier hs-type">assign'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679157871"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679157870"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-144"></span><span>    </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpParams</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157870"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679157869"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157870"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679157871"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">ControlNode</span></span></span></span></span><span>
</span><span id="line-145"></span><span id="assign%27"><span class="annot"><span class="annottext">assign' :: OpParams -&gt; Variable a -&gt; Tensor v a -&gt; m ControlNode
</span><a href="TensorFlow.Variable.html#assign%27"><span class="hs-identifier hs-var hs-var">assign'</span></a></span></span><span> </span><span id="local-6989586621679157733"><span class="annot"><span class="annottext">params :: OpParams
</span><a href="#local-6989586621679157733"><span class="hs-identifier hs-var">params</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span id="local-6989586621679157732"><span class="annot"><span class="annottext">h :: Tensor Value ResourceHandle
</span><a href="#local-6989586621679157732"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span id="local-6989586621679157731"><span class="annot"><span class="annottext">v :: Tensor v a
</span><a href="#local-6989586621679157731"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams
-&gt; Tensor Value ResourceHandle -&gt; Tensor v a -&gt; m ControlNode
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) dtype (m' :: * -&gt; *).
(MonadBuild m', TensorType dtype) =&gt;
OpParams
-&gt; Tensor v'1 ResourceHandle -&gt; Tensor v'2 dtype -&gt; m' ControlNode
</span><span class="hs-identifier hs-var">CoreOps.assignVariableOp'</span></span><span> </span><span class="annot"><span class="annottext">OpParams
</span><a href="#local-6989586621679157733"><span class="hs-identifier hs-var">params</span></a></span><span> </span><span class="annot"><span class="annottext">Tensor Value ResourceHandle
</span><a href="#local-6989586621679157732"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">Tensor v a
</span><a href="#local-6989586621679157731"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-146"></span><span>
</span><span id="line-147"></span><span class="hs-comment">-- | Increments the value of a variable.</span><span>
</span><span id="line-148"></span><span id="local-6989586621679157727"><span id="local-6989586621679157728"><span id="local-6989586621679157729"><span class="annot"><a href="TensorFlow.Variable.html#assignAdd"><span class="hs-identifier hs-type">assignAdd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679157729"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679157728"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-149"></span><span>    </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157728"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679157727"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157728"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679157729"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">ControlNode</span></span></span></span></span><span>
</span><span id="line-150"></span><span id="assignAdd"><span class="annot"><span class="annottext">assignAdd :: Variable a -&gt; Tensor v a -&gt; m ControlNode
</span><a href="TensorFlow.Variable.html#assignAdd"><span class="hs-identifier hs-var hs-var">assignAdd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams -&gt; Variable a -&gt; Tensor v a -&gt; m ControlNode
forall (m :: * -&gt; *) a (v :: * -&gt; *).
(MonadBuild m, TensorType a) =&gt;
OpParams -&gt; Variable a -&gt; Tensor v a -&gt; m ControlNode
</span><a href="TensorFlow.Variable.html#assignAdd%27"><span class="hs-identifier hs-var">assignAdd'</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
forall a. a -&gt; a
</span><span class="hs-identifier hs-var">id</span></span><span>
</span><span id="line-151"></span><span>
</span><span id="line-152"></span><span id="local-6989586621679157724"><span id="local-6989586621679157725"><span id="local-6989586621679157726"><span class="annot"><a href="TensorFlow.Variable.html#assignAdd%27"><span class="hs-identifier hs-type">assignAdd'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679157726"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">TensorType</span></span><span> </span><span class="annot"><a href="#local-6989586621679157725"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-153"></span><span>    </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpParams</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157725"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679157724"><span class="hs-identifier hs-type">v</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157725"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679157726"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">ControlNode</span></span></span></span></span><span>
</span><span id="line-154"></span><span id="assignAdd%27"><span class="annot"><span class="annottext">assignAdd' :: OpParams -&gt; Variable a -&gt; Tensor v a -&gt; m ControlNode
</span><a href="TensorFlow.Variable.html#assignAdd%27"><span class="hs-identifier hs-var hs-var">assignAdd'</span></a></span></span><span> </span><span id="local-6989586621679157723"><span class="annot"><span class="annottext">params :: OpParams
</span><a href="#local-6989586621679157723"><span class="hs-identifier hs-var">params</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span id="local-6989586621679157722"><span class="annot"><span class="annottext">h :: Tensor Value ResourceHandle
</span><a href="#local-6989586621679157722"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span id="local-6989586621679157721"><span class="annot"><span class="annottext">v :: Tensor v a
</span><a href="#local-6989586621679157721"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams
-&gt; Tensor Value ResourceHandle -&gt; Tensor v a -&gt; m ControlNode
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) dtype (m' :: * -&gt; *).
(MonadBuild m', TensorType dtype) =&gt;
OpParams
-&gt; Tensor v'1 ResourceHandle -&gt; Tensor v'2 dtype -&gt; m' ControlNode
</span><span class="hs-identifier hs-var">CoreOps.assignAddVariableOp'</span></span><span> </span><span class="annot"><span class="annottext">OpParams
</span><a href="#local-6989586621679157723"><span class="hs-identifier hs-var">params</span></a></span><span> </span><span class="annot"><span class="annottext">Tensor Value ResourceHandle
</span><a href="#local-6989586621679157722"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">Tensor v a
</span><a href="#local-6989586621679157721"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-155"></span><span>
</span><span id="line-156"></span><span class="hs-comment">-- | Update '*var' according to the Adam algorithm.</span><span>
</span><span id="line-157"></span><span class="hs-comment">--</span><span>
</span><span id="line-158"></span><span class="hs-comment">-- lr_t &lt;- learning_rate * sqrt(1 - beta2^t) / (1 - beta1^t)</span><span>
</span><span id="line-159"></span><span class="hs-comment">-- m_t &lt;- beta1 * m_{t-1} + (1 - beta1) * g_t</span><span>
</span><span id="line-160"></span><span class="hs-comment">-- v_t &lt;- beta2 * v_{t-1} + (1 - beta2) * g_t * g_t</span><span>
</span><span id="line-161"></span><span class="hs-comment">-- variable &lt;- variable - lr_t * m_t / (sqrt(v_t) + epsilon)</span><span>
</span><span id="line-162"></span><span id="local-6989586621679157711"><span id="local-6989586621679157712"><span id="local-6989586621679157713"><span id="local-6989586621679157714"><span id="local-6989586621679157715"><span id="local-6989586621679157716"><span id="local-6989586621679157717"><span id="local-6989586621679157718"><span id="local-6989586621679157719"><span class="annot"><a href="TensorFlow.Variable.html#resourceApplyAdam"><span class="hs-identifier hs-type">resourceApplyAdam</span></a></span><span> </span><span class="hs-glyph">::</span><span>
</span><span id="line-163"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679157719"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-164"></span><span>     </span><span class="annot"><span class="hs-identifier hs-type">OneOf</span></span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Data.Complex.Complex</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-165"></span><span>             </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Data.Complex.Complex</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-166"></span><span>             </span><span class="annot"><span class="hs-identifier hs-type">Data.Int.Int16</span></span><span class="hs-special">,</span><span>
</span><span id="line-167"></span><span>             </span><span class="annot"><span class="hs-identifier hs-type">Data.Int.Int32</span></span><span class="hs-special">,</span><span>
</span><span id="line-168"></span><span>             </span><span class="annot"><span class="hs-identifier hs-type">Data.Int.Int64</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Data.Int.Int8</span></span><span class="hs-special">,</span><span>
</span><span id="line-169"></span><span>             </span><span class="annot"><span class="hs-identifier hs-type">Data.Word.Word16</span></span><span class="hs-special">,</span><span>
</span><span id="line-170"></span><span>             </span><span class="annot"><span class="hs-identifier hs-type">Data.Word.Word8</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span class="hs-special">,</span><span>
</span><span id="line-171"></span><span>             </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span class="hs-special">]</span><span> </span><span class="annot"><a href="#local-6989586621679157718"><span class="hs-identifier hs-type">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-172"></span><span>    </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157718"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-comment">-- ^ __var__: Should be from a Variable().</span><span>
</span><span id="line-173"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157718"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-comment">-- ^ __m__: Should be from a Variable().</span><span>
</span><span id="line-174"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157718"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-comment">-- ^ __v__: Should be from a Variable().</span><span>
</span><span id="line-175"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679157717"><span class="hs-identifier hs-type">v1</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157718"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-comment">-- ^ __beta1_power__: Must be a scalar.</span><span>
</span><span id="line-176"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679157716"><span class="hs-identifier hs-type">v2</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157718"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-comment">-- ^ __beta2_power__: Must be a scalar.</span><span>
</span><span id="line-177"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679157715"><span class="hs-identifier hs-type">v3</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157718"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-comment">-- ^ __lr__: Scaling factor. Must be a scalar.</span><span>
</span><span id="line-178"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679157714"><span class="hs-identifier hs-type">v4</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157718"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-comment">-- ^ __beta1__: Momentum factor. Must be a scalar.</span><span>
</span><span id="line-179"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679157713"><span class="hs-identifier hs-type">v5</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157718"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-comment">-- ^ __beta2__: Momentum factor. Must be a scalar.</span><span>
</span><span id="line-180"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679157712"><span class="hs-identifier hs-type">v6</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157718"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-comment">-- ^ __epsilon__: Ridge term. Must be a scalar.</span><span>
</span><span id="line-181"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679157711"><span class="hs-identifier hs-type">v7</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157718"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-comment">-- ^ __grad__: The gradient.</span><span>
</span><span id="line-182"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679157719"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">ControlNode</span></span><span class="hs-special">)</span></span></span></span></span></span></span></span></span></span><span>
</span><span id="line-183"></span><span id="resourceApplyAdam"><span class="annot"><span class="annottext">resourceApplyAdam :: Variable t
-&gt; Variable t
-&gt; Variable t
-&gt; Tensor v1 t
-&gt; Tensor v2 t
-&gt; Tensor v3 t
-&gt; Tensor v4 t
-&gt; Tensor v5 t
-&gt; Tensor v6 t
-&gt; Tensor v7 t
-&gt; m ControlNode
</span><a href="TensorFlow.Variable.html#resourceApplyAdam"><span class="hs-identifier hs-var hs-var">resourceApplyAdam</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OpParams
-&gt; Variable t
-&gt; Variable t
-&gt; Variable t
-&gt; Tensor v1 t
-&gt; Tensor v2 t
-&gt; Tensor v3 t
-&gt; Tensor v4 t
-&gt; Tensor v5 t
-&gt; Tensor v6 t
-&gt; Tensor v7 t
-&gt; m ControlNode
forall (m :: * -&gt; *) t (v1 :: * -&gt; *) (v2 :: * -&gt; *) (v3 :: * -&gt; *)
       (v4 :: * -&gt; *) (v5 :: * -&gt; *) (v6 :: * -&gt; *) (v7 :: * -&gt; *).
(MonadBuild m,
 OneOf
   '[Complex Double, Complex Float, Int16, Int32, Int64, Int8, Word16,
     Word8, Double, Float]
   t) =&gt;
OpParams
-&gt; Variable t
-&gt; Variable t
-&gt; Variable t
-&gt; Tensor v1 t
-&gt; Tensor v2 t
-&gt; Tensor v3 t
-&gt; Tensor v4 t
-&gt; Tensor v5 t
-&gt; Tensor v6 t
-&gt; Tensor v7 t
-&gt; m ControlNode
</span><a href="TensorFlow.Variable.html#resourceApplyAdam%27"><span class="hs-identifier hs-var">resourceApplyAdam'</span></a></span><span> </span><span class="annot"><span class="annottext">OpParams
forall a. a -&gt; a
</span><span class="hs-identifier hs-var">id</span></span><span>
</span><span id="line-184"></span><span>
</span><span id="line-185"></span><span id="local-6989586621679157836"><span id="local-6989586621679157837"><span id="local-6989586621679157838"><span id="local-6989586621679157839"><span id="local-6989586621679157840"><span id="local-6989586621679157841"><span id="local-6989586621679157842"><span id="local-6989586621679157844"><span id="local-6989586621679157846"><span class="annot"><a href="TensorFlow.Variable.html#resourceApplyAdam%27"><span class="hs-identifier hs-type">resourceApplyAdam'</span></a></span><span> </span><span class="hs-glyph">::</span><span>
</span><span id="line-186"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">MonadBuild</span></span><span> </span><span class="annot"><a href="#local-6989586621679157846"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-187"></span><span>     </span><span class="annot"><span class="hs-identifier hs-type">OneOf</span></span><span> </span><span class="hs-special">'</span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Data.Complex.Complex</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-188"></span><span>             </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Data.Complex.Complex</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-189"></span><span>             </span><span class="annot"><span class="hs-identifier hs-type">Data.Int.Int16</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Data.Int.Int32</span></span><span class="hs-special">,</span><span>
</span><span id="line-190"></span><span>             </span><span class="annot"><span class="hs-identifier hs-type">Data.Int.Int64</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Data.Int.Int8</span></span><span class="hs-special">,</span><span>
</span><span id="line-191"></span><span>             </span><span class="annot"><span class="hs-identifier hs-type">Data.Word.Word16</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Data.Word.Word8</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Double</span></span><span class="hs-special">,</span><span>
</span><span id="line-192"></span><span>             </span><span class="annot"><span class="hs-identifier hs-type">Float</span></span><span class="hs-special">]</span><span> </span><span class="annot"><a href="#local-6989586621679157844"><span class="hs-identifier hs-type">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-193"></span><span>    </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpParams</span></span><span>
</span><span id="line-194"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157844"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-comment">-- ^ __var__: Should be from a Variable().</span><span>
</span><span id="line-195"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157844"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-comment">-- ^ __m__: Should be from a Variable().</span><span>
</span><span id="line-196"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157844"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-comment">-- ^ __v__: Should be from a Variable().</span><span>
</span><span id="line-197"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679157842"><span class="hs-identifier hs-type">v1</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157844"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-comment">-- ^ __beta1_power__: Must be a scalar.</span><span>
</span><span id="line-198"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679157841"><span class="hs-identifier hs-type">v2</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157844"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-comment">-- ^ __beta2_power__: Must be a scalar.</span><span>
</span><span id="line-199"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679157840"><span class="hs-identifier hs-type">v3</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157844"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-comment">-- ^ __lr__: Scaling factor. Must be a scalar.</span><span>
</span><span id="line-200"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679157839"><span class="hs-identifier hs-type">v4</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157844"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-comment">-- ^ __beta1__: Momentum factor. Must be a scalar.</span><span>
</span><span id="line-201"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679157838"><span class="hs-identifier hs-type">v5</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157844"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-comment">-- ^ __beta2__: Momentum factor. Must be a scalar.</span><span>
</span><span id="line-202"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679157837"><span class="hs-identifier hs-type">v6</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157844"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-comment">-- ^ __epsilon__: Ridge term. Must be a scalar.</span><span>
</span><span id="line-203"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Tensor</span></span><span> </span><span class="annot"><a href="#local-6989586621679157836"><span class="hs-identifier hs-type">v7</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679157844"><span class="hs-identifier hs-type">t</span></a></span><span> </span><span class="hs-comment">-- ^ __grad__: The gradient.</span><span>
</span><span id="line-204"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679157846"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">ControlNode</span></span><span class="hs-special">)</span></span></span></span></span></span></span></span></span></span><span>
</span><span id="line-205"></span><span id="resourceApplyAdam%27"><span class="annot"><span class="annottext">resourceApplyAdam' :: OpParams
-&gt; Variable t
-&gt; Variable t
-&gt; Variable t
-&gt; Tensor v1 t
-&gt; Tensor v2 t
-&gt; Tensor v3 t
-&gt; Tensor v4 t
-&gt; Tensor v5 t
-&gt; Tensor v6 t
-&gt; Tensor v7 t
-&gt; m ControlNode
</span><a href="TensorFlow.Variable.html#resourceApplyAdam%27"><span class="hs-identifier hs-var hs-var">resourceApplyAdam'</span></a></span></span><span> </span><span id="local-6989586621679157710"><span class="annot"><span class="annottext">params :: OpParams
</span><a href="#local-6989586621679157710"><span class="hs-identifier hs-var">params</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span id="local-6989586621679157709"><span class="annot"><span class="annottext">var :: Tensor Value ResourceHandle
</span><a href="#local-6989586621679157709"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span id="local-6989586621679157708"><span class="annot"><span class="annottext">m :: Tensor Value ResourceHandle
</span><a href="#local-6989586621679157708"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.Variable.html#Variable"><span class="hs-identifier hs-type">Variable</span></a></span><span> </span><span id="local-6989586621679157707"><span class="annot"><span class="annottext">v :: Tensor Value ResourceHandle
</span><a href="#local-6989586621679157707"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-identifier">_</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-206"></span><span>    </span><span class="annot"><span class="annottext">OpParams
-&gt; Tensor Value ResourceHandle
-&gt; Tensor Value ResourceHandle
-&gt; Tensor Value ResourceHandle
-&gt; Tensor v1 t
-&gt; Tensor v2 t
-&gt; Tensor v3 t
-&gt; Tensor v4 t
-&gt; Tensor v5 t
-&gt; Tensor v6 t
-&gt; Tensor v7 t
-&gt; m ControlNode
forall (v'1 :: * -&gt; *) (v'2 :: * -&gt; *) (v'3 :: * -&gt; *)
       (v'4 :: * -&gt; *) (v'5 :: * -&gt; *) (v'6 :: * -&gt; *) (v'7 :: * -&gt; *)
       (v'8 :: * -&gt; *) (v'9 :: * -&gt; *) (v'10 :: * -&gt; *) t (m' :: * -&gt; *).
(MonadBuild m',
 OneOf
   '[Complex Double, Complex Float, Int16, Int32, Int64, Int8, Word16,
     Word32, Word64, Word8, Double, Float]
   t) =&gt;
OpParams
-&gt; Tensor v'1 ResourceHandle
-&gt; Tensor v'2 ResourceHandle
-&gt; Tensor v'3 ResourceHandle
-&gt; Tensor v'4 t
-&gt; Tensor v'5 t
-&gt; Tensor v'6 t
-&gt; Tensor v'7 t
-&gt; Tensor v'8 t
-&gt; Tensor v'9 t
-&gt; Tensor v'10 t
-&gt; m' ControlNode
</span><span class="hs-identifier hs-var">CoreOps.resourceApplyAdam'</span></span><span> </span><span class="annot"><span class="annottext">OpParams
</span><a href="#local-6989586621679157710"><span class="hs-identifier hs-var">params</span></a></span><span> </span><span class="annot"><span class="annottext">Tensor Value ResourceHandle
</span><a href="#local-6989586621679157709"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="annot"><span class="annottext">Tensor Value ResourceHandle
</span><a href="#local-6989586621679157708"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Tensor Value ResourceHandle
</span><a href="#local-6989586621679157707"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-207"></span></pre></body></html>